<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('机具审核')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: jasny-bootstrap-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-agentPosOperation-add" th:object="${agentPosOperation}">
        <input name="id"  readonly th:field="*{id}" type="hidden" class="form-control" required>
        <h4 class="form-header h4" >购机服务商信息</h4>
        <div class="row">
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">服务商编号：</label>
                <div class="col-sm-8">
                    <input name="agentNum"  readonly id="applyAgentNum" th:field="*{agentNum}" type="text" class="form-control" required>
                    <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">服务商名称：</label>
                <div class="col-sm-8">
                    <input name="agentName" class="form-control" id="applyAgentName"  th:field="*{agentName}" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">团类型：</label>
                <div class="col-sm-8">
                    <select name="teamType" class="form-control m-b" th:field="*{teamType}" required>
                        <option value="">所有</option>
                        <option value="1">老团</option>
                        <option value="2">新团</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">打款类型：</label>
                <div class="col-sm-8">
                    <select name="rewardType" class="form-control m-b" th:field="*{rewardType}" required>
                        <option value="">所有</option>
                        <option value="3">2元</option>
                        <option value="1">4元</option>
                        <option value="2">8元</option>
                    </select>
                </div>
            </div>
        </div>
        <div style="display: none">
            <h4 class="form-header h4" >返现展业端管理信息</h4>
            <div class="row">
                <div class="form-group">
                    <label class="col-sm-3 control-label  is-required">返现展业端管理编号：</label>
                    <div class="col-sm-8">
                        <input name="agentNum"  readonly  th:field="*{returnAgent}" id="targetAgentNum" type="text" class="form-control" >
                        <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">返现展业端管理名称：</label>
                    <div class="col-sm-8">
                        <input name="agentName" class="form-control"  id="targetAgentName" th:field="*{returnAgentName}" type="text" readonly >
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4" >终端信息</h4>
        <div class="row">
            <div class="form-group">
                <label class="col-sm-3 control-label">终端单价：</label>
                <div class="col-sm-8">
                    <input name="oneMoney" th:field="*{oneMoney}" readonly class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">终端数量：</label>
                <div class="col-sm-8">
                    <input name="num" th:field="*{num}" readonly onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">总付款金额：</label>
                <div class="col-sm-8">
                    <input name="allMoney" th:field="*{allMoney}"  readonly class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" th:if="*{posType+'' == '0'}">
                <label class="col-sm-3 control-label">终端类型：</label>
                <div class="col-sm-8">
                    <select name="posType" class="form-control m-b" disabled="disabled">
                        <option value="">所有</option>
                        <option value="4">电签</option>
                        <option value="0" selected="selected">传统</option>
                        <option value="5">GB传统</option>
                    </select>
                </div>
            </div>
            <div class="form-group" th:if="*{posType+'' == '4'}">
                <label class="col-sm-3 control-label">终端类型：</label>
                <div class="col-sm-8">
                    <select name="posType" class="form-control m-b" disabled="disabled">
                        <option value="">所有</option>
                        <option value="4" selected="selected">电签</option>
                        <option value="0" >传统</option>
                    </select>
                </div>
            </div>
        </div>
        <h4 class="form-header h4" >打款信息</h4>
        <div class="row">
            <div class="form-group" th:if="*{dkWay == '1'}">
                <label class="col-sm-3 control-label">打款方式：</label>
                <div class="col-sm-8">
                    <select name="dkWay" class="form-control m-b" disabled="disabled">
                        <option value="">所有</option>
                        <option value="1" selected="selected">现金</option>
                        <option value="2">pos</option>
                        <option value="3">网银</option>
                    </select>
                </div>
            </div>
            <div class="form-group" th:if="*{dkWay == '2'}">
                <label class="col-sm-3 control-label">打款方式：</label>
                <div class="col-sm-8">
                    <select name="dkWay" class="form-control m-b" disabled="disabled">
                        <option value="">所有</option>
                        <option value="1" >现金</option>
                        <option value="2" selected="selected">pos</option>
                        <option value="3">网银</option>
                    </select>
                </div>
            </div>
            <div class="form-group" th:if="*{dkWay == '3'}">
                <label class="col-sm-3 control-label">打款方式：</label>
                <div class="col-sm-8">
                    <select name="dkWay" class="form-control m-b">
                        <option value="">所有</option>
                        <option value="1" >现金</option>
                        <option value="2">pos</option>
                        <option value="3" selected="selected">网银</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">打款人：</label>
                <div class="col-sm-8">
                    <input name="dkMan" minlength="1" readonly th:field="*{dkMan}"  maxlength="6" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">打款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="dkDate" readonly th:field="*{dkDate}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-3 control-label is-required" >上传凭证:</label>
                <br/>
                <div class="col-sm-8">
                    <div class="fileinput fileinput-new" data-provides="fileinput">
                        <div id="homeImgShow" class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;">
                            <img name="imageUrl" th:src="*{imageUrl}"></div>
                        <div>
                                <span class="fileinput-exists">更改</span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <textarea name="note" rows="8" cols="200" class="form-control" type="textarea"></textarea>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">审核状态：</label>
                <div class="col-sm-8">
                    <select name="applyStatus" class="form-control m-b">
                        <option value="">请选择</option>
                        <option value="1">审核通过</option>
                        <option value="2">审核拒绝</option>
                    </select>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: jasny-bootstrap-js" />
<script th:inline="javascript">
    var prefix = ctx + "agentPosOperation/agentPosOperation"
    $("#form-agentPosOperation-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var formData = new FormData($("#form-agentPosOperation-add")[0]);
            $.ajax({
                url: prefix + "/update",
                data: formData,
                type: "post",
                cache: false,
                dataType: "json",
                cache: false,//上传文件无需缓存
                processData: false,//用于对data参数进行序列化处理 这里必须false
                contentType: false, //必须
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍后...");
                },
                success: function (result) {
                    if (result.code == '0') {
                        $.operate.successCallback(result);
                    }else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                },
            })
        }
    }

    $("input[name='examineDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    /**
     * 选择服务商
     */
    function selectAgentInfoListData() {
        var url =prefix+ "/selectAgentInfoAllList";
        $.modal.open("选择服务商" , url, '1100',"500");
    }


    /**
     * 选择本级级以下代理
     */
    function selectAgentInfoRecursiveData() {
        var agentNum = $("#applyAgentNum").val();
        if ($.common.isEmpty(agentNum)){
            $.modal.alertWarning("请选择申请资深总监");
            return;
        }
        var url =prefix+ "/selectAgentInfoList?agentNum="+agentNum;
        $.modal.open("选择下级服务商" , url, '1100',"500");
    }

</script>
</body>
</html>